﻿package mortal.game.view.market.myQiugou
{
    import Message.Game.*;
    import com.mui.controls.*;
    import com.mui.display.*;
    import com.mui.utils.*;
    import fl.data.*;
    import mortal.common.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.resource.*;
    import mortal.game.view.common.*;
    import mortal.game.view.common.pageSelect.*;
    import mortal.game.view.market.sale.*;
    import mortal.mvc.interfaces.*;

    public class MarketMyMktBase extends SmallWindow
    {
        protected var _bgTitle1:ScaleBitmap;
        protected var _title1:GTextFiled;
        protected var _title2:GTextFiled;
        protected var _title3:GTextFiled;
        protected var _list:GTileList;
        protected var _pageSelect:PageSelecter;
        protected var _moneys:MktMoneys;

        public function MarketMyMktBase(param1:ILayer = null)
        {
            super(param1);
            setSize(368, 420);
            _titleHeight = 29;
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            var _loc_1:GTextFormat = null;
            super.createDisposedChildrenImpl();
            _loc_1 = GlobalStyle.textFormatAnjin;
            this._bgTitle1 = UIFactory.bg(13, 34, 350, 25, this, "RegionTitleBg");
            this._title1 = UIFactory.textField("", 40, 0, 90, 20, this, _loc_1);
            this._title1.y = this._bgTitle1.y + (this._bgTitle1.height - this._title1.height) / 2;
            this._title2 = UIFactory.textField("总价", 190, 0, 50, 20, this, _loc_1);
            this._title2.y = this._bgTitle1.y + (this._bgTitle1.height - this._title2.height) / 2;
            this._title3 = UIFactory.textField("操作", 304, 0, 50, 20, this, _loc_1);
            this._title3.y = this._bgTitle1.y + (this._bgTitle1.height - this._title3.height) / 2;
            this._list = UIFactory.tileList(25, 65, 342, 258, this);
            this._list.rowHeight = 50;
            this._list.columnWidth = 342;
            this._list.horizontalGap = 0;
            this._list.verticalGap = 0;
            this._list.setStyle("cellRenderer", MktMyCellRenderner);
            this._list.rowCount = 5;
            this._pageSelect = UIFactory.pageSelecter(0, 337, this, PageSelecter.CompleteMode);
            this._pageSelect.x = 125;
            this._pageSelect.setbgStlye(ImagesConst.ComboBg, new GTextFormat());
            this._pageSelect.maxPage = 1;
            this._pageSelect.pageTextBoxSize = 36;
            this._moneys = UICompomentPool.getUICompoment(MktMoneys);
            this._moneys.createDisposedChildren();
            this._moneys.x = 31;
            this._moneys.y = 366;
            addChild(this._moneys);
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            super.disposeImpl(param1);
            this._bgTitle1.dispose(param1);
            this._title1.dispose(param1);
            this._title2.dispose(param1);
            this._title3.dispose(param1);
            this._list.dispose(param1);
            this._pageSelect.dispose(param1);
            this._moneys.dispose(param1);
            this._bgTitle1 = null;
            this._title1 = null;
            this._title2 = null;
            this._title3 = null;
            this._list = null;
            this._pageSelect = null;
            this._moneys = null;
            return;
        }// end function

        protected function resetUI() : void
        {
            return;
        }// end function

        protected function getDataProvider(param1:Array) : DataProvider
        {
            var _loc_2:* = new DataProvider();
            if (param1 == null)
            {
                return _loc_2;
            }
            var _loc_3:* = this._list.rowCount * this._list.columnCount;
            var _loc_4:* = (this._pageSelect.currentPage - 1) * _loc_3;
            var _loc_5:* = Math.min(_loc_4 + _loc_3, param1.length);
            var _loc_6:* = _loc_4;
            while (_loc_6 < _loc_5)
            {
                
                _loc_2.addItem(param1[_loc_6]);
                _loc_6++;
            }
            this._pageSelect.currentPage = Math.ceil((_loc_4 + 1) / _loc_3);
            this._pageSelect.maxPage = Math.ceil(param1.length / _loc_3);
            return _loc_2;
        }// end function

        public function updatePanel(param1:SSeqMarketItem) : void
        {
            this._list.dataProvider = this.getDataProvider(param1.marketItems);
            this._list.drawNow();
            return;
        }// end function

    }
}
